<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            width: 3000px;
            height: 3000px;
        }
        #btn{
            position: fixed;
            top: 0;
            left: 0;
        }
    </style>
</head>
<body>
    <button id="btn">卷</button>
    <script>
        btn.onclick = function(){
            //点击这个按钮,让滚动卷
            /* 这个是第一种写法 */
            // window.scrollTo(200,200)//X轴200,Y轴200 不丝滑
            /* 第二中写法,在里面写一个对象 */
            window.scrollTo({
                top:100,
                left:100,
                behavior:"smooth"
            })
        }
    </script>
</body>
</html>